-
Notifications
You must be signed in to change notification settings - Fork 240
Refactor RawFeltVec
#3849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: spr/master/b701265d
Are you sure you want to change the base?
Refactor RawFeltVec
#3849
Conversation
f3341f3 to
975c55c
Compare
5be308b to
2fb1cab
Compare
2fb1cab to
5f1378b
Compare
975c55c to
b529f57
Compare
5f1378b to
61e2887
Compare
b529f57 to
a5347c6
Compare
61e2887 to
b6dbc2c
Compare
275f396 to
12fa2fe
Compare
b6dbc2c to
7a5f8b2
Compare
| /// use this wrapper to NOT add extra length felt | ||
| /// useful e.g. when you need to pass an already serialized value | ||
| #[derive(Debug)] | ||
| pub struct NoLengthFeltVec<T>(pub Vec<T>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could name it SerializedValue? As this i think is only usefull if value is serialized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming
12fa2fe to
f955261
Compare
7a5f8b2 to
69854b2
Compare
commit-id:30d7f8cd
69854b2 to
45efdc4
Compare
| impl<T: CairoDeserialize, E: CairoDeserialize> CairoDeserialize for Result<T, E> { | ||
| fn deserialize(reader: &mut BufferReader<'_>) -> BufferReadResult<Self> { | ||
| let variant: Felt = reader.read()?; | ||
| let variant: usize = variant.to_usize().ok_or(BufferReadError::ParseFailed)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
| let variant: usize = variant.to_usize().ok_or(BufferReadError::ParseFailed)?; | |
| let variant = variant.to_usize().ok_or(BufferReadError::ParseFailed)?; |
| /// | ||
| /// Use this to omit adding extra felt for the length of the vector during serialization. | ||
| #[derive(Debug)] | ||
| pub struct SerializedValue<T>(pub Vec<T>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also drop generic. Only valid representation i would say is pub struct SerializedValue(pub Vec<Felt>)
| } | ||
| } | ||
|
|
||
| impl CairoDeserialize for SerializedValue<Felt> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
Stack:
RawFeltVec#3849 ⬅